home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Report Writers / Crystal Repot 9.0 Full CD version / Setup.exe / ProgramF / CRYSTAL / CRW9 / DEV / INCLUDE / Ufdll.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-05-09  |  13.4 KB  |  525 lines

  1. /*
  2. ** File:    UFDll.h
  3. ** Author:  Rex Benning, Rick Cameron
  4. ** Date:    3 Mar 93
  5. **
  6. ** Purpose: Declarations for a user-defined function DLL
  7. **
  8. ** Modified : Ivanka Jankovic
  9. ** Date: 14.12.1995
  10. ** Added time and date-time types
  11. */
  12.  
  13. #if !defined (UFDLL_H)
  14. #define UFDLL_H
  15.  
  16. #if !defined (CRDLL_H)
  17.   #include "crdll.h"
  18. #endif
  19.  
  20. // Set 1-byte structure alignment
  21. #if !defined (PLAT_UNIX) && !defined (MAINWIN)
  22.   #if defined (__BORLANDC__) // Borland C/C++
  23.     #pragma option -a-
  24.   #elif defined (_MSC_VER) // Microsoft Visual C++
  25.     #if _MSC_VER >= 900 // MSVC 2.x and later
  26.       #pragma pack (push)
  27.     #endif
  28.     #pragma pack (1)
  29.   #endif
  30. #endif
  31.  
  32. #if !defined(_WIN32)
  33.   #define PASCAL
  34. #endif
  35.  
  36. #if defined (__cplusplus)
  37. extern "C"
  38. {
  39. #endif
  40.  
  41. #define UFVersion1              0x0100
  42. #define UFVersion5              0x0500
  43.  
  44. #define UFMaxNArguments 50
  45.  
  46. #define UFMaxStringLength 254
  47. #define UFUnknownStringLength MaxInt16u
  48.  
  49. typedef CRInt8s UFTInt8s;
  50. typedef CRInt8u UFTInt8u;
  51.  
  52. typedef CRInt16s UFTInt16s;
  53. typedef CRInt16u UFTInt16u;
  54.  
  55. typedef CRInt32s UFTInt32s;
  56. typedef CRInt32u UFTInt32u;
  57.  
  58. typedef CRNumber  UFTNumber;
  59. typedef UFTNumber UFTCurrency;
  60.  
  61. typedef CRDate UFTDate;
  62. typedef CRTime UFTTime;
  63. typedef CRDateTime UFTDateTime;
  64.  
  65. typedef CRBoolean UFTBoolean;
  66.  
  67. #define UFNumberScalingFactor CRNumberScalingFactor
  68.  
  69. typedef CRInt8u UFTRangeInfo;
  70. #define UFRngInfoExcludeUpperBound 0x01
  71. #define UFRngInfoExcludeLowerBound 0x02
  72. #define UFRngInfoNoUpperBound      0x04
  73. #define UFRngInfoNoLowerBound      0x08
  74.  
  75. typedef enum UFError
  76. {
  77.     UFUserError = -1,
  78.     UFNoError,
  79.     UFNoMemory,
  80.     UFStringTooBig,
  81.     UFDivideByZero,
  82.     UFArrayIndexTooBig,
  83.     UFStringIndexTooBig,
  84.     UFNotEnoughParameters,
  85.     UFMemCalcFail
  86. }
  87.     UFError;
  88.  
  89. typedef enum UFReturnTypes
  90. {
  91.     UFUndefinedReturn,
  92.     UFStringReturn,
  93.     UFNumberReturn,
  94.     UFDateReturn,
  95.     UFBooleanReturn,
  96.     UFCurrencyReturn,
  97.     UFDateRangeReturn,
  98.     UFNumberRangeReturn,
  99.     UFCurrencyRangeReturn,
  100.     UFStringRangeReturn,
  101.     UFStringArrayReturn,
  102.     UFNumberArrayReturn,
  103.     UFDateArrayReturn,
  104.     UFBooleanArrayReturn,
  105.     UFCurrencyArrayReturn,
  106.     UFTimeReturn,
  107.     UFDateTimeReturn,
  108.     UFTimeRangeReturn,
  109.     UFDateTimeRangeReturn,
  110.     UFTimeArrayReturn,
  111.     UFDateTimeArrayReturn,
  112.     UFNumberRangeArrayReturn,
  113.     UFCurrencyRangeArrayReturn,
  114.     UFDateRangeArrayReturn,
  115.     UFTimeRangeArrayReturn,
  116.     UFDateTimeRangeArrayReturn,
  117.     UFStringRangeArrayReturn,
  118.     UFLastReturnType
  119. }
  120.     UFReturnTypes;
  121.  
  122. typedef enum UFTypeDefs
  123. {
  124.     UFUndefinedType,
  125.     UFNumber,
  126.     UFCurrency,
  127.     UFNumberToCurrency,
  128.     UFUnusedType0, // Ignore
  129.     UFBoolean,
  130.     UFDate,
  131.     UFStringArg,
  132.     UFNumberRange,
  133.     UFCurrencyRange,
  134.     UFNumberToCurrencyRange,
  135.     UFUnusedType1, // Ignore
  136.     UFUnusedType2, // Ignore
  137.     UFDateRange,
  138.     UFStringRange,
  139.     UFNumberArray,
  140.     UFCurrencyArray,
  141.     UFNumberToCurrencyArray,
  142.     UFUnusedType3, // Ignore
  143.     UFBooleanArray,
  144.     UFDateArray,
  145.     UFStringArray,
  146.     UFUnusedType4, // Ignore
  147.     UFTime,
  148.     UFDateTime,
  149.     UFTimeRange,
  150.     UFDateTimeRange,
  151.     UFTimeArray,
  152.     UFDateTimeArray,
  153.     UFNumberRangeArray,
  154.     UFCurrencyRangeArray,
  155.     UFNumberToCurrencyRangeArray,
  156.     UFDateRangeArray,
  157.     UFTimeRangeArray,
  158.     UFDateTimeRangeArray,
  159.     UFStringRangeArray
  160. }
  161.     UFTypeDefs;
  162.  
  163. typedef union UFParamUnion
  164. {
  165.     UFTNumber   ParamNumber;
  166.     UFTCurrency ParamCurrency;
  167.     UFTBoolean  ParamBoolean;
  168.     UFTDate     ParamDate;
  169.     UFTTime     ParamTime;
  170.     UFTDateTime ParamDateTime;
  171.     char FAR *  ParamString;
  172.  
  173.     struct ParamNumberRange
  174.     {
  175.         UFTNumber ParamNumberStart;
  176.         UFTNumber ParamNumberEnd;
  177.     }
  178.         ParamNumberRange;
  179.  
  180.     struct ParamCurrencyRange
  181.     {
  182.         UFTCurrency ParamCurrencyStart;
  183.         UFTCurrency ParamCurrencyEnd;
  184.     }
  185.         ParamCurrencyRange;
  186.  
  187.     struct ParamDateRange
  188.     {
  189.         UFTDate ParamDateStart;
  190.         UFTDate ParamDateEnd;
  191.     }
  192.         ParamDateRange;
  193.  
  194.     struct ParamTimeRange
  195.     {
  196.         UFTTime ParamTimeStart;
  197.         UFTTime ParamTimeEnd;
  198.     }
  199.         ParamTimeRange;
  200.  
  201.     struct ParamDateTimeRange
  202.     {
  203.         UFTDateTime ParamDateTimeStart;
  204.         UFTDateTime ParamDateTimeEnd;
  205.     }
  206.         ParamDateTimeRange;
  207.  
  208.     struct ParamStringRange
  209.     {
  210.         char FAR *ParamStringStart;
  211.         char FAR *ParamStringEnd;
  212.     }
  213.         ParamStringRange;
  214.  
  215.     UFTNumber   FAR *ParamNumberArray;
  216.     UFTCurrency FAR *ParamCurrencyArray;
  217.     UFTBoolean  FAR *ParamBooleanArray;
  218.     UFTDate     FAR *ParamDateArray;
  219.     UFTTime     FAR *ParamTimeArray;
  220.     UFTDateTime FAR *ParamDateTimeArray;
  221.     char FAR *  FAR *ParamStringArray;
  222.  
  223.     // Range arrays are implemented as pairs of entries: even for starts, odd for ends.
  224.     UFTNumber   FAR *ParamNumberRangeArray;
  225.     UFTCurrency FAR *ParamCurrencyRangeArray;
  226.     UFTDate     FAR *ParamDateRangeArray;
  227.     UFTTime     FAR *ParamTimeRangeArray;
  228.     UFTDateTime FAR *ParamDateTimeRangeArray;
  229.     char FAR *  FAR *ParamStringRangeArray;
  230.  
  231.     void        FAR *ParamArrayPointer;
  232.  
  233.     struct UFMemCalcParam FAR *MemCalcSubParam;
  234. }
  235.     UFParamUnion;
  236.  
  237. typedef struct UFParamListElement
  238. {
  239.     UFTInt16u StructSize;
  240.     struct UFParamListElement FAR *NextParam;
  241.     // For range arrays, this is the number of pairs of values (start and end).
  242.     UFTInt16s ParamLength;
  243.     UFTypeDefs ParamType;
  244.     UFParamUnion Parameter;
  245.     
  246.     // One entry for ranges, N entries for range arrays.
  247.     UFTRangeInfo FAR *ParamRangeInfo;
  248. }
  249.     UFParamListElement;
  250. #define UFParamListElementSize  (sizeof (UFParamListElement))
  251.  
  252. typedef struct UFParamListElement0 // Obsolete: use the preceding structure instead.
  253. {
  254.     UFTInt16u StructSize;
  255.     struct UFParamListElement FAR *NextParam;
  256.     UFTInt16s ParamLength;
  257.     UFTypeDefs ParamType;
  258.     UFParamUnion Parameter;
  259. }
  260.     UFParamListElement0;
  261. #define UFParamListElement0Size  (sizeof (UFParamListElement0))
  262.  
  263. typedef enum UFMemCalcParmTypes
  264. {
  265.     UFLiteral,
  266.     UFArray,
  267.     UFUnusedType, // Ignore
  268.     UFExpression
  269. }
  270.     UFMemCalcParmTypes;
  271.  
  272. // For use when asking the DLL how much memory to allocate for a returned string or array.
  273. typedef struct UFMemCalcParam 
  274. {
  275.     UFTInt16u StructSize;
  276.     struct UFMemCalcParam FAR *NextMemCalcParam;
  277.     
  278.     // For strings, the length includes the trailing null byte. For arrays (future), it is
  279.     // the number of entries. For range arrays (future), this is the number of pairs of
  280.     // values (start and end).
  281.     UFTInt16s MemCalcParamLength; 
  282.     
  283.     UFMemCalcParmTypes MemCalcLiteralFlag;
  284.     UFTypeDefs MemCalcParamType;
  285.     UFParamUnion MemCalcParameter;
  286.  
  287.     // One entry for ranges, N entries for range arrays (future).
  288.     UFTRangeInfo FAR *MemCalcRangeInfo;
  289. }
  290.     UFMemCalcParam;
  291. #define UFMemCalcParamSize      (sizeof (UFMemCalcParam))
  292.  
  293. typedef struct UFMemCalcParam0 // Obsolete: use the preceding structure instead.
  294. {
  295.     UFTInt16u StructSize;
  296.     struct UFMemCalcParam FAR *NextMemCalcParam;
  297.     UFTInt16s MemCalcParamLength; 
  298.     UFMemCalcParmTypes MemCalcLiteralFlag;
  299.     UFTypeDefs MemCalcParamType;
  300.     UFParamUnion MemCalcParameter;
  301. }
  302.     UFMemCalcParam0;
  303. #define UFMemCalcParam0Size       (sizeof (UFMemCalcParam0))
  304.  
  305. typedef union UFReturnUnion
  306. {
  307.     UFTNumber   ReturnNumber;
  308.     UFTCurrency ReturnCurrency;
  309.     UFTBoolean  ReturnBoolean;
  310.     UFTDate     ReturnDate;
  311.     UFTTime     ReturnTime;
  312.     UFTDateTime ReturnDateTime;
  313.     char FAR *  ReturnString;
  314.  
  315.     struct ReturnNumberRange
  316.     {
  317.         UFTNumber ReturnNumberStart;
  318.         UFTNumber ReturnNumberEnd;
  319.     }
  320.         ReturnNumberRange;
  321.  
  322.     struct ReturnCurrencyRange
  323.     {
  324.         UFTCurrency ReturnCurrencyStart;
  325.         UFTCurrency ReturnCurrencyEnd;
  326.     }
  327.         ReturnCurrencyRange;
  328.  
  329.     struct ReturnDateRange
  330.     {
  331.         UFTDate ReturnDateStart;
  332.         UFTDate ReturnDateEnd;
  333.     }
  334.         ReturnDateRange;
  335.  
  336.     struct ReturnTimeRange
  337.     {
  338.         UFTTime ReturnTimeStart;
  339.         UFTTime ReturnTimeEnd;
  340.     }
  341.         ReturnTimeRange;
  342.  
  343.     struct ReturnDateTimeRange
  344.     {
  345.         UFTDateTime ReturnDateTimeStart;
  346.         UFTDateTime ReturnDateTimeEnd;
  347.     }
  348.         ReturnDateTimeRange;
  349.  
  350.     struct ReturnStringRange
  351.     {
  352.         char FAR *ReturnStringStart;
  353.         char FAR *ReturnStringEnd;
  354.     }
  355.         ReturnStringRange;
  356.  
  357.     UFTNumber   FAR *ReturnNumberArray;
  358.     UFTCurrency FAR *ReturnCurrencyArray;
  359.     UFTBoolean  FAR *ReturnBooleanArray;
  360.     UFTDate     FAR *ReturnDateArray;
  361.     UFTTime     FAR *ReturnTimeArray;
  362.     UFTDateTime FAR *ReturnDateTimeArray;
  363.     char FAR *  FAR *ReturnStringArray;
  364.  
  365.     // Range arrays are implemented as pairs of entries: even for starts, odd for ends.
  366.     UFTNumber   FAR *ReturnNumberRangeArray;
  367.     UFTCurrency FAR *ReturnCurrencyRangeArray;
  368.     UFTDate     FAR *ReturnDateRangeArray;
  369.     UFTTime     FAR *ReturnTimeRangeArray;
  370.     UFTDateTime FAR *ReturnDateTimeRangeArray;
  371.     char FAR *  FAR *ReturnStringRangeArray;
  372.  
  373.     UFTInt32s UFReturnUserError;
  374. }
  375.     UFReturnUnion;
  376.  
  377. typedef enum UFMemCalcType
  378. {
  379.     UFCalcStringLength,
  380.     UFCalcArraySize
  381. }
  382.     UFMemCalcType;
  383.  
  384. typedef struct UFParamBlock
  385. {
  386.     UFTInt16u StructSize;
  387.  
  388.     UFReturnUnion ReturnValue;
  389.     // For range arrays, this is the number of pairs of values (start and end).
  390.     UFTInt16s ReturnValueLength;
  391.     
  392.     UFTInt16s FunctionNumber;
  393.     void (FAR PASCAL *UFErrorHandler) (UFError);
  394.     UFParamListElement FAR *UFParamList;
  395.     UFTInt32u JobId;
  396.  
  397.     // One entry for ranges, N entries for range arrays.
  398.     UFTRangeInfo FAR *ReturnRangeInfo;
  399. }
  400.     UFParamBlock;
  401. #define UFParamBlockSize        (sizeof (UFParamBlock))
  402.  
  403. typedef struct UFParamBlock0 // Obsolete: use the preceding structure instead.
  404. {
  405.     UFTInt16u StructSize;
  406.     UFReturnUnion ReturnValue;
  407.     UFTInt16s ReturnValueLength;
  408.     UFTInt16s FunctionNumber;
  409.     void (FAR PASCAL *UFErrorHandler) (UFError);
  410.     UFParamListElement FAR *UFParamList;
  411.     UFTInt32u JobId;
  412. }
  413.     UFParamBlock0;
  414. #define UFParamBlock0Size       (sizeof (UFParamBlock0))
  415.  
  416. // For use when asking the DLL how much memory to allocate for a returned string or array.
  417. typedef struct UFMemCalcBlock
  418. {
  419.     UFTInt16u StructSize;
  420.     UFMemCalcType MemCalcCommand;
  421.     // For range arrays, this is the number of pairs of values (start and end).
  422.     UFTInt16s UFMemCalcArrayLength;
  423.     UFTInt16s UFMemCalcStringLength;
  424.     UFMemCalcParam FAR *UFMemCalcParamList; // For calculating string sizes
  425.     UFParamListElement FAR *UFParamList;    // For calculating array sizes.
  426. }
  427.     UFMemCalcBlock;
  428. #define UFMemCalcBlockSize      (sizeof (UFMemCalcBlock))
  429.  
  430. typedef struct UFFunctionDefStrings
  431. {
  432.     char FAR *FuncDefString;
  433.     UFError (FAR PASCAL *UFEntry) (UFParamBlock FAR *);
  434.     UFError (FAR PASCAL *UFMemCalcFunc) (UFMemCalcBlock FAR *);
  435. }
  436.     UFFunctionDefStrings;
  437.  
  438. typedef struct UF5FunctionDefStrings
  439. {
  440.     char FAR *FuncDefString;
  441.     UFError (FAR PASCAL *UFEntry) (UFParamBlock FAR *);
  442.     UFError (FAR PASCAL *UFMemCalcFunc) (UFMemCalcBlock FAR *);
  443.     UFTBoolean callOnlyWhilePrintingRecords;
  444.     UFTBoolean hasSideEffects;
  445. }
  446.     UF5FunctionDefStrings;
  447.  
  448. /* An encasing structure for extendability, the first element will indicate, and check, 
  449. ** which version of the interface is in use. It is set by the compiler using the 
  450. ** sizeof operator. Any changes to the interface must change the size of this structure.
  451. ** typedef struct
  452. */
  453. typedef struct UFFunctionDefStringList
  454. {
  455.     UFTInt16u StructSize;
  456.     UFFunctionDefStrings FAR *UFFunctionDefStrPtr;
  457. }
  458.     UFFunctionDefStringList;
  459. #define UFFunctionDefStringListSize (sizeof (UFFunctionDefStringList))
  460.  
  461. typedef struct UF5FunctionDefStringList
  462. {
  463.     UFTInt16u StructSize;
  464.     UF5FunctionDefStrings FAR *UF5FunctionDefStrPtr;
  465. }
  466.     UF5FunctionDefStringList;
  467. #define UF5FunctionDefStringListSize (sizeof (UF5FunctionDefStringList))
  468.  
  469. typedef struct UFFunctionTemplates
  470. {
  471.     char FAR *FuncTemplate;
  472. }
  473.     UFFunctionTemplates;
  474.  
  475. /* An encasing structure for extendability, the first element will indicate, and check,
  476. ** which version of the interface is in use. It is set by the compiler using the sizeof 
  477. ** operator. Any changes to the interface must change the size of this structure.
  478. ** typedef struct
  479. */
  480. typedef struct UFFunctionTemplateList
  481. {
  482.     UFTInt16u StructSize;
  483.     UFFunctionTemplates FAR *UFFuncTemplatePtr;
  484. }
  485.     UFFunctionTemplateList;
  486. #define UFFunctionTemplateListSize (sizeof (UFFunctionTemplateList))
  487.  
  488. typedef struct UFFunctionExamples
  489. {
  490.     char FAR *FuncExample;
  491. }
  492.     UFFunctionExamples;
  493.  
  494. /* An encasing structure for extendability, the first element will indicate, and check,
  495. ** which version of the interface is in use. It is set by the compiler using the sizeof
  496. ** operator. Any changes to the interface must change the size of this structure.
  497. ** typedef struct
  498. */
  499. typedef struct UFFunctionExampleList
  500. {
  501.     UFTInt16u StructSize;
  502.     UFFunctionExamples FAR *FuncExample;
  503. }
  504.     UFFunctionExampleList;
  505. #define UFFunctionExampleListSize (sizeof (UFFunctionExampleList))
  506.  
  507. #if defined (__cplusplus)
  508. }
  509. #endif
  510.  
  511. // Reset structure alignment
  512. #if !defined (PLAT_UNIX) && !defined (MAINWIN)
  513.   #if defined (__BORLANDC__)
  514.     #pragma option -a.
  515.   #elif defined (_MSC_VER)
  516.     #if _MSC_VER >= 900
  517.       #pragma pack (pop)
  518.     #else
  519.       #pragma pack ()
  520.     #endif
  521.   #endif
  522. #endif
  523.  
  524. #endif // UFDLL_H
  525.